﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace DispatchingTelephonePOC.Views
{
    /// <summary>
    /// OfflineSpeech.xaml 的交互逻辑
    /// </summary>
    public partial class OfflineSpeech : Window
    {
        public OfflineSpeech()
        {
            InitializeComponent();
        }

        private static OfflineSpeech offlineSpeech;

        public static OfflineSpeech Instance()
        {
            if (offlineSpeech == null)
            {
                offlineSpeech = new OfflineSpeech();
            }
            return offlineSpeech;
        }
        /// <summary>
        /// 窗体移动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DockPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }
        public void SetTextBoxValue(string MyMessage)
        {
            this.Dispatcher.BeginInvoke(new Action(() =>
            {
                if (MyMessage == "Down")
                {
                    OPENImage.Source = new BitmapImage(new Uri("/Images/话筒开.png", UriKind.Relative)); 
                    MyMessage = string.Empty;
                }
                else if (MyMessage == "Up")
                {
                    MyMessage = string.Empty;
                    OPENImage.Source = new BitmapImage(new Uri("/Images/话筒关.png", UriKind.Relative));
                }
                IRSTextBox.Text = MyMessage;
            }));
        }
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 关闭窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WindowClose_Click(object sender, RoutedEventArgs e)
        {
            this.Visibility = Visibility.Collapsed;
        }
    }
}
